import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserTaskManageVO, UserTaskManageForm, UserTaskManageQuery } from '@/api/mushcoin/userTaskManage/types';

/**
 * 查询用户任务管理(H5)列表
 * @param query
 * @returns {*}
 */

export const listUserTaskManage = (query?: UserTaskManageQuery): AxiosPromise<UserTaskManageVO[]> => {
  return request({
    url: '/mushcoin/userTaskManage/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户任务管理(H5)详细
 * @param id
 */
export const getUserTaskManage = (id: string | number): AxiosPromise<UserTaskManageVO> => {
  return request({
    url: '/mushcoin/userTaskManage/' + id,
    method: 'get'
  });
};

/**
 * 新增用户任务管理(H5)
 * @param data
 */
export const addUserTaskManage = (data: UserTaskManageForm) => {
  return request({
    url: '/mushcoin/userTaskManage',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户任务管理(H5)
 * @param data
 */
export const updateUserTaskManage = (data: UserTaskManageForm) => {
  return request({
    url: '/mushcoin/userTaskManage',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户任务管理(H5)
 * @param id
 */
export const delUserTaskManage = (id: string | number | Array<string | number>) => {
  return request({
    url: '/mushcoin/userTaskManage/' + id,
    method: 'delete'
  });
};
